package com.jrx.anytxn.reporting.job.unionFile.step;

import com.jrx.anytxn.common.uitl.DateUtils;
import com.jrx.anytxn.reporting.constant.ReportingConstant;
import com.jrx.anytxn.transaction.entity.TlInterestAccrualLog;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.batch.MyBatisPagingItemReader;

import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class SuppInterestFileReader extends MyBatisPagingItemReader<TlInterestAccrualLog> {

    public SuppInterestFileReader(SqlSessionFactory sqlSessionFactory, Integer pagesize){
        setSaveState(false);
        setPageSize(pagesize);
        setSqlSessionFactory(sqlSessionFactory);
        setQueryId("com.jrx.anytxn.transaction.mapper.ext.ExtTlInterestAccrualLogMapper.selectByBeginDateAndAccountType");
        Map<String, Object> map = new HashMap<>();
        Date beginDate = DateUtils.parseDate("2021-01-15");
        map.put("accrualDate", beginDate);
        //罚息 复利都算罚息
        map.put("accountTypeList", Arrays.asList(ReportingConstant.INTEREST_ACCRUAL_TYPE_66,ReportingConstant.INTEREST_ACCRUAL_TYPE_10,ReportingConstant.INTEREST_ACCRUAL_TYPE_20));
        setParameterValues(map);
    }
}
